﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Expand.Collections.Generic
{
    public static class LinkedListExtensionMethods
    {
        public static ReverseLinkedList<T> GetReverseLinkedList<T>(this LinkedList<T> linkedList)
        {
            return linkedList as ReverseLinkedList<T>;
        }

        public static void SwapWith<T>(this LinkedListNode<T> first, LinkedListNode<T> second)
        {
            if (first == null)
                throw new ArgumentNullException("first");

            if (second == null)
                throw new ArgumentNullException("second");

            T tmp = first.Value;
            first.Value = second.Value;
            second.Value = tmp;
        }
    }
}
